package com.jpa.demo.common;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 *@ClassName addDeptDto
 *@Author 郭承乐
 *@Date 2024/8/20 16:17
 *@Version 1.0
 **/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class ResponseData {
  
    // 状态码，例如HTTP状态码，但这里可以根据业务自定义  
    private int code;  
  
    // 响应消息  
    private String message;  
  
    // 响应数据  
    private Object data;

    //分页需要的数据
    private Long total;
  

    public static ResponseData success(Object data) {  
        return new ResponseData(200, "操作成功", data,null);
    }  
    public static ResponseData pageSuccess(Object data,Long total) {
        return new ResponseData(200, "操作成功", data,total);
    }


    public static ResponseData error(int code, String message) {  
        return new ResponseData(code, message, null,null);
    }  
  

}